package com.financing.wap.service.impl;


import java.sql.SQLException;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import com.financing.wap.common.CommonConstantUtil.CommonStatus;
import com.financing.wap.dao.IDstUserVisitLogDao;
import com.financing.wap.dto.DstUserVisitLogDTO;
import com.financing.wap.service.IDstUserVisitLogService;
import com.financing.wap.util.DTOdateSetUtil;
/**
 * dst_user_visit_log  
 * 用户访问文章记录 业务访问层实现类
 * @author huqiyun
 *
 */
 
@Service("dstUserVisitLogService")
public class DstUserVisitLogServiceImpl implements IDstUserVisitLogService{

	@Autowired
	private IDstUserVisitLogDao dstUserVisitLogDao;

	@Override
	public int insert(DstUserVisitLogDTO dstUserVisitLog) throws SQLException {
		DTOdateSetUtil.setCreateInfo(dstUserVisitLog);
		DTOdateSetUtil.setUpdateInfo(dstUserVisitLog);
		dstUserVisitLog.setDeleteTag(CommonStatus.DELETE_TAG_NORMAL);
		return dstUserVisitLogDao.insert(dstUserVisitLog);
	}

	@Override
	public void update(DstUserVisitLogDTO dstUserVisitLog) throws SQLException {
		DTOdateSetUtil.setUpdateInfo(dstUserVisitLog);
		dstUserVisitLogDao.update(dstUserVisitLog);
	}

	@Override
	public void updateForce(DstUserVisitLogDTO dstUserVisitLog) throws SQLException {
		DTOdateSetUtil.setUpdateInfo(dstUserVisitLog);
		dstUserVisitLogDao.updateForce(dstUserVisitLog);
	}

	@Override
	public void delete(Integer id) throws SQLException {
		dstUserVisitLogDao.delete(id);
	}
	
	@Override
	public List<DstUserVisitLogDTO> queryList(DstUserVisitLogDTO dstUserVisitLog) throws SQLException {
		return dstUserVisitLogDao.queryList(dstUserVisitLog);
	}

	@Override
	public int queryListCount(DstUserVisitLogDTO dstUserVisitLog) throws SQLException {
		return dstUserVisitLogDao.queryListCount(dstUserVisitLog);
	}

	@Override
	public DstUserVisitLogDTO loadById(Integer id) throws SQLException {
		return dstUserVisitLogDao.loadById(id);
	}
 	@Override
	public DstUserVisitLogDTO queryListGetFirst(DstUserVisitLogDTO dstUserVisitLog)
			throws SQLException {
		 List<DstUserVisitLogDTO> queryList = queryList(dstUserVisitLog);
		 if(queryList==null||queryList.size()==0){
			 return new DstUserVisitLogDTO();
		 }
		 return queryList.get(0);
	}
}
